AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )

include('shared.lua')

ENT.Dropped = false;
ENT.typ = "weapon"
//models/Items/grenadeAmmo.mdl models/Weapons/W_missile_closed.mdl
//Sound local RocketSound = Sound( "Missile.Accelerate" )
function ENT:Initialize()

	self.Entity:PhysicsInitSphere(10,"metal");
	self.Entity:SetCollisionBounds(Vector(1,1,1)*-5,Vector(1,1,1)*5);
	self.Entity:PhysicsInit(SOLID_VPHYSICS);
	self.Entity:SetMoveType(MOVETYPE_VPHYSICS);
	self.Entity:SetSolid(SOLID_VPHYSICS);
	self:DrawShadow(false)
	self.Entity:SetRenderMode(RENDERMODE_TRANSALPHA)
	self:PhysWake()
	self.Phys = self.Entity:GetPhysicsObject();
	if(self.Phys and self.Phys:IsValid()) then
		self.Phys:SetMass(5*10);
		self.Phys:EnableGravity(false);
	end



end

function ENT:PhysicsCollide(data, physobj)
 
 self:Explosion()
self.Entity:Remove()

end

function ENT:Think()



end

function ENT:OnTakeDamage( dmginfo )
end

function ENT:Explosion()

	
	local shake = ents.Create( "env_shake" )
		shake:SetOwner( self.GrenadeOwner )
		shake:SetPos( self.Entity:GetPos() )
		shake:SetKeyValue( "amplitude", "2000" )
		shake:SetKeyValue( "radius", "400" )
		shake:SetKeyValue( "duration", "2.5" )
		shake:SetKeyValue( "frequency", "255" )
		shake:SetKeyValue( "spawnflags", "4" )
		shake:Spawn()
		shake:Activate()
		shake:Fire( "StartShake", "", 0 )
	
	for k, v in pairs ( ents.FindInSphere( self.Entity:GetPos(), 250 ) ) do
		v:Fire( "EnableMotion", "", math.random( 0, 0.5 ) )
	end
	
end



function ENT:Touch( entity )

	self:Explosion()
	self.Entity:Remove()


end